{% extends "base.html" %}

{% block content %}
<div class="row">
    <div class="col-md-12 mb-4">
        <div class="d-flex justify-content-between align-items-center">
            <h2>掌握 "{{ skill.name }}" 技能的成员</h2>
            <a href="{{ url_for('skills.index') }}" class="btn btn-outline-primary">返回技能列表</a>
        </div>
    </div>
</div>

<div class="row row-cols-1 row-cols-md-3 g-4">
    {% for user in skill.users %}
    <div class="col">
        <div class="card h-100">
            <div class="card-body">
                <h5 class="card-title">{{ user.name }}</h5>
                <h6 class="card-subtitle mb-2 text-muted">{{ '管理员' if user.role == 'admin' else '成员' }}</h6>
                <p class="card-text">
                    <strong>其他技能:</strong><br>
                    {% for user_skill in user.skills %}
                    {% if user_skill.id != skill.id %}
                    <span class="badge bg-secondary">{{ user_skill.name }}</span>
                    {% endif %}
                    {% endfor %}
                </p>
            </div>
            <div class="card-footer">
                <a href="{{ url_for('users.profile', id=user.id) }}" class="btn btn-primary">查看档案</a>
            </div>
        </div>
    </div>
    {% endfor %}
</div>

{% if not skill.users %}
<div class="alert alert-info">
    目前没有成员掌握此技能。
</div>
{% endif %}
{% endblock %}